-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add structures::gdt::Entry type #380
Conversation
The current documentation for the GDT often confuses entries and `Descriptor`s. For example, adding a new `Descriptor` uses a method confusingly named `add_entry`. An entry is a raw 64-bit value that is indexed by a segment selector. The `MAX` length of the GDT is a number of _entries_, not `Descriptor`s. To fix this confusion, this PR makes the following changes: - Adds a transparent `u64` newtype called `Entry`. - Updates the `GlobalDescriptorTable` documentation to correctly use `Entry` or `Descriptor` where appropriate. - Renames the `add_entry` to `append`. - This better expresses that this method might add multiple entries. - Renames `from_raw_slice` to `from_raw_entries` - Renames `as_raw_slice` to `entries` - This method now returns a slice of `Entry`s instead of `u64`s This also fixes an issue where our `assert!`s in `empty()` wouldn't trigger if the GDT was constructed from raw values. Signed-off-by: Joe Richey <joerichey@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall changes seem good to me, I left some minor comments.
Signed-off-by: Joe Richey <joerichey@google.com>
Also update the documentation Signed-off-by: Joe Richey <joerichey@google.com>
Signed-off-by: Joe Richey <joerichey@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
The current documentation for the GDT often confuses entries and
Descriptor
s.For example, adding a new
Descriptor
uses a method confusingly namedadd_entry
.An entry is a raw 64-bit value that is indexed by a segment selector.
The
MAX
length of the GDT is a number of entries, notDescriptor
s.To fix this confusion, this PR makes the following changes:
u64
newtype calledEntry
.GlobalDescriptorTable
documentation to correctly useEntry
orDescriptor
where appropriate.add_entry
toappend
.from_raw_slice
tofrom_raw_entries
as_raw_slice
toentries
Entry
s instead ofu64
sThis also fixes an issue where our
assert!
s inempty()
wouldn'ttrigger if the GDT was constructed from raw values.
Signed-off-by: Joe Richey joerichey@google.com